package com.lehecai.core.game;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

/**
 * 游戏销售状态
 * @author He Wang
 *
 */
public class GameSellStatus extends IntegerBeanLabelItem {

	private static final long serialVersionUID = 7009455804239792650L;
	private static final Logger logger = LoggerFactory.getLogger(GameSellStatus.class.getName());
	
	private static List<GameSellStatus> items = new ArrayList<GameSellStatus>();
	private static List<GameSellStatus> queryItems = new ArrayList<GameSellStatus>();
	
	protected GameSellStatus(String name, int value) {
		this(name, value, false);
	}
	
	protected GameSellStatus(String name, int value, boolean queryOnly) {
		super(GameSellStatus.class.getName(), name, value);
		queryItems.add(this);
		
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	public static GameSellStatus getItem(int value){
		try {
			return (GameSellStatus)GameSellStatus.getResult(GameSellStatus.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<GameSellStatus> getItems() {
		return items;
	}
	
	public static List<GameSellStatus> getQueryItems() {
		return queryItems;
	}
	
	public static final GameSellStatus ALL = new GameSellStatus("全部", -1, true);
	public static final GameSellStatus LOTTERY_GAME = new GameSellStatus("默认", 0);
	public static final GameSellStatus LHC_GAME = new GameSellStatus("新", 1);
	public static final GameSellStatus THIRD_PARTY_INITIATIVE_GAME = new GameSellStatus("推荐", 2);
	public static final GameSellStatus THIRD_PARTY_PLATFORM_GAME = new GameSellStatus("活动", 3);
}
